package com.group.config;

import com.group.entity.ProjectOutside;
import com.group.service.ProjectOutsideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@SuppressWarnings("all")
public class Async {

    @Autowired
    ProjectOutsideService projectOutsideService;

    @Scheduled(cron = "0 0 1 * * ?")
    //每天凌晨一点
    public List<ProjectOutside> findMinGanProject() throws IOException {
        HashMap map = new HashMap();
        //输入流
        FileInputStream in = new FileInputStream("C:\\Users\\Administrator\\Desktop\\敏感词.txt");
        BufferedReader br = new BufferedReader(new InputStreamReader(in, "GB2312"));
        String line;
        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }
        br.close();

        List<ProjectOutside> projectOutsideList = (List<ProjectOutside>) projectOutsideService.listByMap(map);
        return projectOutsideList;
//        return null;
    }

}
